# coding: utf-8
'''

Python函数式编程

函数式编程的特点: 允许把函数本身作为一个参数传入函数, 还允许返回一个函数
'''

a = [1,2,3,4,5,6,7]
b = filter(lambda x: x>5, a)
print b # [6, 7]

a = map(lambda x: x*2, [1,2,3])
print a # [2, 4, 6]

c = reduce(lambda x,y: x*y, range(1,5))
print c # 120 = (((1*2)*3)*4)*5
